﻿<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

	<head>
		<meta charset="UTF-8"></meta>
		<title>管理员查询</title>
		<link rel="stylesheet" th:href="@{/plugins/layui/css/layui.css}" media="all" />
	</head>

	<body>
            
<!--             <blockquote class="layui-elem-quote" > -->
					
<form class="layui-form" method="post" action="#" id="popupForm" >
  <input type="hidden" name="instanceId"  th:value="${commRoleInfo.instanceId}"/>
  <div class="layui-form-item">
    <label class="layui-form-label">账号：</label>
    <div class="layui-inline">
      <input type="text" name="userAccount" lay-verify="required" autocomplete="off" placeholder="请输入账号" class="layui-input"/>
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">密码：</label>
    <div class="layui-inline">
      <input type="passWord" name="passWord" placeholder="请输入密码" autocomplete="off" class="layui-input"/>
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">真实姓名：</label>
    <div class="layui-inline">
      <input type="text" name="userName" lay-verify="required" placeholder="请输入真实姓名" autocomplete="off" class="layui-input"/>
    </div>
  </div>
<!--     <div class="layui-form-item">
    <label class="layui-form-label">企业名称</label>
    <div class="layui-input-block">
      <select name="instanceId" lay-search="">
             <option value="">请选择供</option>
             <option th:each="supplier : ${apinsList}" th:value="${supplier.instanceId}" th:text="${supplier.enterpriseName}"></option>
       </select>
    </div>
  </div> -->
 <div class="layui-inline">
     <label class="layui-form-label">分配角色：</label>
    <div class="layui-inline">
    <ul>
    <li>
    <input th:each="prod : ${roleList}" type="checkbox" name="roleIdString" th:title="${prod.roleName}" lay-skin="primary" th:value="${prod.roleInfoId}" />
   <!--  <input type="checkbox" name="roleIdString" th:title="${prod.roleName}" lay-skin="primary" th:value="${prod.roleInfoId}"/> -->
    </li>
    </ul>
</div>
  </div> 
  <div></div>
    <div style="margin:10px;text-align:center"  >
    <!-- <button data-method="offset" data-type="auto" lay-submit="" lay-filter="role1" class="layui-btn layui-btn-normal">提交</button> -->
    
	<button lay-submit="" lay-filter="go" class="layui-btn  layui-btn-normal">提交 </button>
  </div>
</form>
		<!-- 	</blockquote> -->
			
    
			  
        
        
		        <script type="text/javascript" th:src="@{/plugins/layui/layui.js}"></script>
        <script>
        layui.use('form', function () {
            var form = layui.form;
            $ = layui.jquery;
            // 这个是在iframe里面的js代码
            var frameindex = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
            form.on('submit(go)', function (data) {
                var roleIdString='';
                $("input:checkbox[name='roleIdString']:checked").each(function() { // 遍历name=standard的多选框
                	roleIdString +=   $(this).val()+',';

                });
    			data.field.roleIdString=roleIdString.substring(0,roleIdString.length-1);
    	
                var index = layer.load(1, {
                    shade: [0.1, '#fff'] //0.1透明度的白色背景
                });
                var url = '/merchant/setting/addSave';
                $.post(url, data.field, function (ev) {
                    if (ev.code == 000000) {
                        layer.msg(ev.msg);
                        parent.location.href = "/merchant/setting/manage";
                    } else {
                        layer.close(index);
                        layer.msg(ev.msg);
                    }
                }, 'json')
                //发送ajax
                return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
            });
        });
    </script>

 
</body>
</html>